Full source code website bán hàng thương mại điện tử gần giống shopee
472.887 lượt xem;
1 <cfsetting enablecfoutputonly="Yes">
2 <!---
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 * - GNU General Public License Version 2 or later (the "GPL")
12 * http://www.gnu.org/licenses/gpl.html
13 *
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * http://www.gnu.org/licenses/lgpl.html
16 *
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * ColdFusion integration.
23 * Note this module is created for use with Coldfusion 4.52 and above.
24 * For a cfc version for coldfusion mx check the fckeditor.cfc.
25 *
26 * Syntax:
27 *
28 * <cfmodule name="path/to/cfc/fckeditor"
29 * instanceName="myEditor"
30 * toolbarSet="..."
31 * width="..."
32 * height="..:"
33 * value="..."
34 * config="..."
35 * >
36 --->
37 <!--- ::
38 * Attribute validation
39 :: --->
40 <cfparam name="attributes.instanceName" type="string">
41 <cfparam name="attributes.width" type="string" default="100%">
42 <cfparam name="attributes.height" type="string" default="200">
43 <cfparam name="attributes.toolbarSet" type="string" default="Default">
44 <cfparam name="attributes.value" type="string" default="">
45 <cfparam name="attributes.basePath" type="string" default="/fckeditor/">
46 <cfparam name="attributes.checkBrowser" type="boolean" default="true">
47 <cfparam name="attributes.config" type="struct" default="#structNew()#">
48 <cfinclude template="fckutils.cfm">
49
50 <!--- ::
51 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
52 :: --->
53
54 <cfscript>
55 if( attributes.checkBrowser )
56 {
57 isCompatibleBrowser = FCKeditor_IsCompatibleBrowser();
58 }
59 else
60 {
61 // If we should not check browser compatibility, assume true
62 isCompatibleBrowser = true;
63 }
64 </cfscript>
65
66 <cfif isCompatibleBrowser>
67
68 <!--- ::
69 * show html editor area for compatible browser
70 :: --->
71
72 <cfscript>
73 // try to fix the basePath, if ending slash is missing
74 if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
75 attributes.basePath = attributes.basePath & "/";
76
77 // construct the url
78 sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
79
80 // append toolbarset name to the url
81 if( len( attributes.toolbarSet ) )
82 sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
83
84 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
85
86 /**
87 * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
88 * So we need to find out the correct case for the configuration keys.
89 * We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
90 * changed 20041206 hk@lwd.de (improvements are welcome!)
91 */
92 lConfigKeys = "";
93 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
94 lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
95 lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
96 lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
97 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
98 lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
99 lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
100 lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
101 lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
102 lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
103 lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
104 lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
105 lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
106 lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
107 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
108 lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
109 lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
110 lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
111 lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
112 lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
113
114 sConfig = "";
115
116 for( key in attributes.config )
117 {
118 iPos = listFindNoCase( lConfigKeys, key );
119 if( iPos GT 0 )
120 {
121 if( len( sConfig ) )
122 sConfig = sConfig & "&";
123
124 fieldValue = attributes.config[key];
125 fieldName = listGetAt( lConfigKeys, iPos );
126
127 sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
128 }
129 }
130 </cfscript>
131
132 <cfoutput>
133 <input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
134 <input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
135 <iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
136 </cfoutput>
137
138 <cfelse>
139
140 <!--- ::
141 * show plain textarea for non compatible browser
142 :: --->
143
144 <cfscript>
145 // append unit "px" for numeric width and/or height values
146 if( isNumeric( attributes.width ) )
147 attributes.width = attributes.width & "px";
148 if( isNumeric( attributes.height ) )
149 attributes.height = attributes.height & "px";
150 </cfscript>
151
152 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
153 <cfoutput>
154 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
155 </cfoutput>
156
157 </cfif>
158
159 <cfsetting enablecfoutputonly="No"><cfexit method="exittag">
2 <!---
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 * - GNU General Public License Version 2 or later (the "GPL")
12 * http://www.gnu.org/licenses/gpl.html
13 *
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * http://www.gnu.org/licenses/lgpl.html
16 *
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * ColdFusion integration.
23 * Note this module is created for use with Coldfusion 4.52 and above.
24 * For a cfc version for coldfusion mx check the fckeditor.cfc.
25 *
26 * Syntax:
27 *
28 * <cfmodule name="path/to/cfc/fckeditor"
29 * instanceName="myEditor"
30 * toolbarSet="..."
31 * width="..."
32 * height="..:"
33 * value="..."
34 * config="..."
35 * >
36 --->
37 <!--- ::
38 * Attribute validation
39 :: --->
40 <cfparam name="attributes.instanceName" type="string">
41 <cfparam name="attributes.width" type="string" default="100%">
42 <cfparam name="attributes.height" type="string" default="200">
43 <cfparam name="attributes.toolbarSet" type="string" default="Default">
44 <cfparam name="attributes.value" type="string" default="">
45 <cfparam name="attributes.basePath" type="string" default="/fckeditor/">
46 <cfparam name="attributes.checkBrowser" type="boolean" default="true">
47 <cfparam name="attributes.config" type="struct" default="#structNew()#">
48 <cfinclude template="fckutils.cfm">
49
50 <!--- ::
51 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
52 :: --->
53
54 <cfscript>
55 if( attributes.checkBrowser )
56 {
57 isCompatibleBrowser = FCKeditor_IsCompatibleBrowser();
58 }
59 else
60 {
61 // If we should not check browser compatibility, assume true
62 isCompatibleBrowser = true;
63 }
64 </cfscript>
65
66 <cfif isCompatibleBrowser>
67
68 <!--- ::
69 * show html editor area for compatible browser
70 :: --->
71
72 <cfscript>
73 // try to fix the basePath, if ending slash is missing
74 if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
75 attributes.basePath = attributes.basePath & "/";
76
77 // construct the url
78 sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
79
80 // append toolbarset name to the url
81 if( len( attributes.toolbarSet ) )
82 sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
83
84 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
85
86 /**
87 * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
88 * So we need to find out the correct case for the configuration keys.
89 * We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
90 * changed 20041206 hk@lwd.de (improvements are welcome!)
91 */
92 lConfigKeys = "";
93 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
94 lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
95 lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
96 lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
97 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
98 lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
99 lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
100 lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
101 lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
102 lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
103 lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
104 lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
105 lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
106 lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
107 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
108 lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
109 lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
110 lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
111 lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
112 lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
113
114 sConfig = "";
115
116 for( key in attributes.config )
117 {
118 iPos = listFindNoCase( lConfigKeys, key );
119 if( iPos GT 0 )
120 {
121 if( len( sConfig ) )
122 sConfig = sConfig & "&";
123
124 fieldValue = attributes.config[key];
125 fieldName = listGetAt( lConfigKeys, iPos );
126
127 sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
128 }
129 }
130 </cfscript>
131
132 <cfoutput>
133 <input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
134 <input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
135 <iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
136 </cfoutput>
137
138 <cfelse>
139
140 <!--- ::
141 * show plain textarea for non compatible browser
142 :: --->
143
144 <cfscript>
145 // append unit "px" for numeric width and/or height values
146 if( isNumeric( attributes.width ) )
147 attributes.width = attributes.width & "px";
148 if( isNumeric( attributes.height ) )
149 attributes.height = attributes.height & "px";
150 </cfscript>
151
152 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
153 <cfoutput>
154 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
155 </cfoutput>
156
157 </cfif>
158
159 <cfsetting enablecfoutputonly="No"><cfexit method="exittag">